
<%@page import="ejb.Videogame"%>
<%@page import="ejb.Notizia"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.LinkedList"%>
<%@page import="java.util.List"%>
<%@page import="ejb.Utente"%>
<%@page import="ejb.ArticoloNuovo"%>
<%@page import="ejb.ArticoloUsato"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@include file="wrapper.jsp" %>
<%
String tipo = "uv";
    if (session.getAttribute("utente") != null) {
        Utente utSession = (Utente) session.getAttribute("utente");
        tipo = utSession.getTipo();
    }
%>
<div class="container">
      <div class="row-fluid">
        <div class="span3 bs-docs-sidebar">
        <ul class="nav nav-list bs-docs-sidenav">
            <% if (request.getParameter("platform")!=null) {%>
          <li><a href="Controller?button=visualizzaRecNot&platform=<%=request.getParameter("platform")%>&type=news"> <button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Notizie</button> </a></li>
          <li><a href="Controller?button=visualizzaRecNot&platform=<%=request.getParameter("platform")%>&type=reviews"><button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Recensioni</button> </a></li>
          <li><a href="Controller?button=visualizzaRecNot&platform=<%=request.getParameter("platform")%>&type=both"><button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Entrambe</button> </a></li>
          <%}else{ %>
          <li><a href="Controller?button=visualizzaRecNot&platform=all&type=news"> <button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Notizie</button> </a></li>
          <li><a href="Controller?button=visualizzaRecNot&platform=all&type=reviews"><button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Recensioni</button> </a></li>
          <li><a href="Controller?button=visualizzaRecNot&platform=all&type=both"><button class="btn btn-large btn-inverse btn-block" type="button"><i class="icon-white icon-th-list"></i> Entrambe</button> </a></li>
          <%}%>
        </ul>
      </div>
      <div class="span6">
              
              <%
                LinkedList<ArticoloNuovo> carrello = (LinkedList<ArticoloNuovo>)session.getAttribute("carrello");
                Integer totCarrello=0;
                List<ArticoloUsato> usatiDaConfermare= (List<ArticoloUsato>)session.getAttribute("usatiDaConfermare");
              
                Notizia notizia = (Notizia)request.getAttribute("NotiziaSelezionata");
                String testo=(String)request.getAttribute("testo");
                DateFormat dataFormat = new SimpleDateFormat("dd-MM-yyyy");
                String data = dataFormat.format(notizia.getData());
        
                  %>
                 <div class="thumbnail">
                    <h3 style="padding-left:10px"><%=notizia.getTitolo()%></h3>
                    <p style="padding-left:10px;"> di <em style="font-family: italic"> <%=notizia.getAutore().getNome()+" "+notizia.getAutore().getCognome()%></em></p>
                    <p><b style="padding-left:10px">Inserito il:</b> <%=data%></p>
                    <img src="<%=notizia.getImmaginePath() %>"  align="left" style="padding-left:10px;padding-top:5px;height: 200px;width: 400px">   
                    <br><br><br><br><br><br><br><br><br><br>
                    <p align="JUSTIFY" style="margin-top: 30px;margin-left:10px; margin-right: 10px" name="testo" ><%=testo%></p>
                  
                    
                </div>
                 
       
 </div>
 <div class="span3">
            <%
                if (tipo.equals("u")) {
            %>
            <div class="thumbnail">
                <p><b>Carrello</b></p>
                <table>
                    <tr><td></td><td style="padding-left: 5px"><b>Articolo</b></td><td style="padding-left: 5px"><b>Costo</b></td></tr>
                    <tr><td><br></td><td><br></td><td><br></td></tr>
                            <%
                                for (ArticoloNuovo a : carrello) {
                                    totCarrello = totCarrello + a.getPrezzo();
                            %>
                    <tr>
                    <p>
                    <td>
                        <a href="Controller?button=removeCarrello&amp;idArticolo=<%=a.getId()%>">
                            <button class="btn btn-inverse btn-mini"><i class="icon-white icon-trash"></i></button>
                        </a>
                    </td>
                    <td style="padding-left: 5px;height: 20px;width:100%;overflow:hidden;float:left"><%=a.getNome()%></td>
                    <td style="padding-left: 5px"><%=a.getPrezzo().toString()%> €</td>
                    </p>
                    </tr>
                    <tr><td><br></td><td><br></td><td><br></td></tr>
                            <%}%>
                    <tr><td></td><td><b>Totale</b></td><td style="padding-left: 5px"><%=totCarrello.toString()%> €</td></tr>
                </table>
            </div>
            <br>
            <br>
            <%} else if (tipo.equals("a")) {%>
            <div class="thumbnail">
                <p><b>Notes</b></p>
                <br>
                <% if (!usatiDaConfermare.isEmpty()) {%>
                <p> Ancora <%=usatiDaConfermare.size()%> articoli da confermare </p>
                <br>
                <p align="center">
                    <a href="Controller?button=modificaCancellaArtUsati&amp;confirm=s">
                        <button class="btn btn-inverse btn-small"><i class="icon-white icon-th-list"></i> Vedi Articoli da confermare</button>
                    </a>
                </p>
                <%} else {%>
                <p> Nessun articolo da confermare </p>
                <%}%>      
            </div>
            <br>
            <br>
            <%}%>

            <form  class="navbar-search" action="Controller"> <input type="text" name="cerca" class="search-query span3" style="width:220px;" placeholder="Cerca"><div class="icon-search" ></div></form>
        </div>       

 </div>           
</div>
</body>
</html>

 

 